package com.homegoods.orderinfodetail.ui.activity;

import android.Manifest;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.cyt.chattlibrary.inputboard.ChatSoftInputLayout;
import com.homegoods.aroutercomment.ARouterPath;
import com.homegoods.orderinfodetail.R;
import com.homegoods.orderinfodetail.databinding.InfoActivityChattBinding;
import com.kedll.library.base.MyBaseFragmentActivity;
import com.kedll.library.mvp.BasePresenter;

import permissions.dispatcher.NeedsPermission;
import permissions.dispatcher.RuntimePermissions;

/**
 * @author QiQi
 * @ClassName: ChattActivity
 * @date 2018/10/23
 * @description 店铺客服
 */

@RuntimePermissions
@Route(path = ARouterPath.PATH_GOODS_SERVICE)
public class ChattActivity extends MyBaseFragmentActivity<InfoActivityChattBinding, BasePresenter> {

    private RecyclerView mList;

    @Override
    protected void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        ChattActivityPermissionsDispatcher.recordAudioWithPermissionCheck(this);

        initList();

        mBinding.softInput.setOperationDelegate(new ChatSoftInputLayout.OnComposeOperationDelegate() {
            @Override
            public void onSendText(String text) {

            }

            @Override
            public void onSendVoice(String file, int length) {

            }

            @Override
            public void onSendImageClicked(View v) {

            }

            @Override
            public void onSendPhotoClicked(View view) {

            }

            @Override
            public void onSendLocationClicked(View v) {

            }
        });
    }

    private void initList() {
        mList = mBinding.softInput.getList();
        mList.setLayoutManager(new LinearLayoutManager(getContext()));
        mList.setHasFixedSize(true);
        mList.setBackgroundResource(R.color.main_background_color);
    }

    @Override
    protected BasePresenter getPresenter() {
        return null;
    }

    @Override
    protected int getLayout() {
        return R.layout.info_activity_chatt;
    }

    @Override
    protected void initEvent() {

    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        ChattActivityPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults);
    }

    @NeedsPermission(Manifest.permission.RECORD_AUDIO)
    void recordAudio() {
    }
}
